﻿using System.Collections.Generic;
using System.Web.Mvc;
using GTAuto.DAL.DAL;
using GTAuto.DAL.Entities;

namespace GTauto.Site.FrontEnd.Controllers
{
    public class FirmsController : Controller
    {
        //
        // GET: /Firms/

        public ActionResult Index()
        {
            int count; 
            List<GTFirmCategory> firmCats = DALFirmCategory.Singleton.GetPaged(1, 10000, out count);
            return View(firmCats);
        }
        


        public ActionResult FirmsByCat(int id) 
        {
            List<GTFirm> firmsInCategory = DALFirms.Singleton.FirmsInCategory(id);

            Session["CurFirmCategory"] = id;

            return View(firmsInCategory);
        }


        public ActionResult FirmView(int id)
        {

            var firm = DALFirms.Singleton.Get(id);
            return View(firm);
        }

    }
}
